<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>一笑网-登录</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="../../static/layui/css/layui.css" />
        <link rel="stylesheet" href="../../static/css/yx.css" />
        <script src="../../static/js/jquery-2.1.4.min.js" ></script>
        <script src="../../static/layui/layui.all.js" ></script>
        <script src="../../static/js/yx.js" >/*公共js*/</script>
        
        <style type="text/css">
        	
        	html{height: 100%;}
        	body{height: 100%;background-size: 100% 100%;background-image: url(../../static/img/login.jpg);}
        	.formfox{
        		max-width: 30rem;min-height: 15rem;
        		padding: 3em 4em;
        		background-color: #FFF;
        		margin: 10rem auto;
        	}
        	
        	.formfox *{border-radius: 0px;}
        	.formfox a{margin-left: 0.5em;color: #666;}
        	.formfox a:hover{color: red;}
        	[name=setpwd]{margin-left: 1em; width: 1em;height: 1em;position: relative;top: 3px;}
        	
        </style>
        <script type="text/javascript">
        	
        	
        	$(function(){
        		
        		
        		
        		//监听回车
        		$("input").bind("keypress",function(e){  
				  	// 兼容FF和IE和Opera      
				    var theEvent = e || window.event;      
				    var code = theEvent.keyCode || theEvent.which || theEvent.charCode;      
				    if (code == 13) {                    
				        e.preventDefault();
				        $('body').focus();
				    	$(".login").click();	//回车执行查询     
				    }   
				});  
        		
        		
        		//
        		$(".login").click(function(){
        			var token=$("[name=token]").val();
        			var pwd=$("[name=pwd]").val();
        			if(token==""||pwd==""){
        				return layer.msg("请填写!");
        			}
        			
        			var setpwd=$("[name=setpwd]").prop("checked");	//是否记住密码
        			setpwd = setpwd == true ? 1 : 0;
        			var way = 2;//登录方式：1=uid,2=昵称,3=手机号
        			if(isNaN(token) == false) {
        				way = token.length == 11 ? 3 : 1;
        			}

					$.post2("doLogin.ajax",{token:token,pwd:pwd,way:way,setpwd:setpwd},function(data){
						if(data.res==1){
							layer.msg(data.msg,{icon:6});
							setTimeout(function(){
								location.href="../home/index.html";
							},800)
						}else{
							layer.msg(data.msg,{icon:5,anim:6});
						}
					},function(e,ee,eee){
						layer.alert('异常：'+eee);
					})
					
        		})
        		
        		//提示请先登录
        		if("${way}"==1){
        			layer.alert('请先登录');
        		}
        		
        		
        		
        	})
        	
        	
        </script>
    </head>
    <body class="yx-phone-max-height">
    	
    	<div class="formfox">
    		<h2 class="yx-color-one">一笑网 登录</h2><br />
    		<input name="token" class="layui-input yx-input" placeholder="ID号/昵称/手机号" value="${login_usee.uid}"/><br />
    		<input name="pwd" class="layui-input yx-input" type="password" placeholder="密码" value="${login_usee.pwd}"/><br />
    		
    		<input class="login layui-btn yx-bg-one" type="button" value="登录"/>
    		<input type="checkbox" name="setpwd" checked> <span style="color: #666;">记住密码</span><br /><br />
    		<a href="zhuce.html">去注册</a>
    		<a href="../home/index.html">游客进入</a>
    		<a href="javascript:layer.alert('忘了就再注册个吧');">密码忘记?</a>
    	</div>
    	
 	</body>
</html>